An iterator of the columns of the array.
double[][] nums = [[1.0d, 2.0d], [10.0d, 20.0d]] assert nums.transpose() == nums.columns().toList()
Flattens a 2D array into a new collection. The items are copied row by row.
Example usage:
double[][] array = [[0.0f, 1.0f], [2.0f, 3.0f]] assert array.flatten() == [0.0f, 1.0f, 2.0f, 3.0f]
A transpose method for 2D double arrays.
Example usage:
double[][] doubles = [[1.0d, 10.0d], [2.0d, 20.0d]] double[][] expected = [[1.0d, 2.0d], [10.0d, 20.0d]] def result = doubles.transpose() assert result == expected assert doubles.class.componentType == result.class.componentType